package file;

import java.io.File;

public class CreateNewFileDemo {
    public static void main(String[] args) {
        File file = new File("./test.txt");
        if (file.exists()) {
            System.out.println("文件已存在");
        }else{
            try {
                file.createNewFile();
            } catch (Exception e) {
                System.out.println("文件创建失败");
            }
            System.out.println("文件创建成功");
        }
    }
}
